package com.mo.list;

/**
 * @ClassName Node
 * @Description 链表实体类
 * @Author Administrator
 * @Date 2021/8/3
 * @Version 1.0
 */
public class Node {
    int data;
    Node next;
    public static int toStringTimes = 0;

    public Node() {
    }

    public Node(int data) {
        this.data = data;
    }

    @Override
    public String toString() {
        toStringTimes++;
        if (this.next != null) {
            //多次调用toString
            return this.data + "," + next.toString();

        } else {

            return "" + this.data;
        }
    }
}
